package com.test.io;

import java.io.*;
import java.util.Scanner;

/**
 * @Description:
 * @Author: yangzhiwei
 * @Date: 2021/3/18 9:52
 */
public class ByteToChar {
    public static void main(String[] args) throws FileNotFoundException {
        File file = new File(FileInfo.ChineseFile);
        file.setExecutable(false);
        System.out.println(file.getName());
        System.out.println(file.getAbsolutePath());
        System.out.println(file.getAbsoluteFile());
        System.out.println(file.getParent());
        System.out.println("getPath" + file.getPath());

        System.out.println(file.getName());
        System.out.println(file.mkdirs());


        File file1 = new File("D:\\javaFile\\cc\\中文.txt");
        file1.mkdirs();
        System.out.println(file.canRead());
        System.out.println(file.canWrite());
        System.out.println(file.canExecute());


        System.out.println();
        //System.setIn(new FileInputStream(FileInfo.EnglishFile));
        System.setOut(new PrintStream(new FileOutputStream(FileInfo.EnglishFile)));
        PrintStream ps;
//        System.setIn();
//        System.setOut();
//        System.setErr();

        //in.nextLine();
       // ps.println();



        FileInputStream inputStream = new FileInputStream(FileInfo.EnglishFile);
//        InputStreamReader reader = new InputStreamReader(new FileReader(FileInfo.EnglishFile));

        // Java多线程读取控制台

        new Thread(new Runnable() {
            @Override
            public void run() {
                String res2;
                Scanner in = new Scanner(System.in);
                while((res2 = in.nextLine()) != "") {
                    System.out.println(Thread.currentThread().getName() + res2);
                    try {
                        Thread.sleep(5000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        }).start();

        String res1;
        Scanner in = new Scanner(System.in);
        while((res1 = in.nextLine()) != "") {
            System.out.println(Thread.currentThread().getName() + res1);

            try {
                Thread.sleep(5000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }

        StringBufferInputStream stringBufferInputStream;


        DataOutputStream dataOutputStream = new DataOutputStream(new FileOutputStream(FileInfo.EnglishFile));
        DataOutputStream bufferDataOutputStream = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(FileInfo.EnglishFile)));

        BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(new DataOutputStream(new FileOutputStream(FileInfo.EnglishFile)));

        BufferedInputStream bufferedInputStream;

        

    }
}
